@extends('adviser')

@section('otherResouviserrce')

@endsection
<style>
    .icon {
        margin-right: 5px;
        font-size: 0.8em;;
    }

    .search {
        padding-top: 1.3em;
        margin-bottom: 2em;
        padding-left: -2em;
    }

    .title {
        margin-left: 0.7em;
    }


</style>

@section('rightPanel')
    <div class="row">
        <h1 class="page-header col-md-11">建议管理</h1>
    </div>



    <div class="row head">
        <form>
            <h3 class="col-md-2 col-lg-2  title">所有用户</h3>

            <div class="input-group col-lg-offset-2 col-lg-3 col-md-3 search">
                <input id="search" placeholder="搜索用户" type="text" class="form-control input-md">
                 <span class=input-group-addon><span
                             class=" glyphicon glyphicon-search" onclick="Foo();"></span></span>
            </div>
        </form>
    </div>

    <div class="table-responsive col-md-10">
        <table class="table table-striped table-hover">
            <thead>
            <tr>
                <th>序号</th>
                <th>待建议用户</th>
                <th>详细健康数据</th>
            </tr>
            </thead>
            <tbody>
           @if(isset($error))
                <tr>
                    <td> {{$error}}</td>
                    <td> {{$error}}</td>
                    <td> {{$error}}</td>
                <tr>
                @endif
            @foreach($users as $u)
                <tr>
                    <td>{{$i++}}</td>
                    <td>{{$u['user']}}</td>
                    <td>
                        <span class="icon"><a href='/adviceHome/userHealthData/{{$u['user']}}'>健康数据</a></span>
                        <span class="icon"><a href='/adviceHome/userSportsData/{{$u['user']}}'>运动数据</a></span>
                        <span class="icon"><a href='/adviceHome/adviceTo/{{$u['user']}}'>写建议</a></span>
                        <!--
                        <span class="glyphicon glyphicon-menu-down icon" aria-hidden="true" role="button"
                              data-toggle="tooltip" data-placement="bottom" title="健康数据"
                              onclick="document.location='/adviceHome/userHealthData/{{$u['user']}}';"></span>
                        <span class="glyphicon glyphicon-menu-up icon" aria-hidden="true" role="button"
                              data-toggle="tooltip" data-placement="bottom" title="运动数据"
                              onclick="document.location='/adviceHome/userSportsData/{{$u['user']}}';"></span>
                        <span class="glyphicon glyphicon-pencil icon" aria-hidden="true" role="button"
                              data-toggle="tooltip" data-placement="bottom" title="写建议"
                              onclick="document.location='/adviceHome/adviceTo/{{$u['user']}}';"></span>
                              -->
                    </td>
                </tr>
            @endforeach
            </tbody>
        </table>
    </div>
    <div class="row col-md-9">
        {!!$users->render()!!}
    </div>
@endsection

@section('otherJs')
    <script>
        $(function () {
            $("[data-toggle='tooltip']").tooltip();
            $('#search').bind('keypress',function(event){
                if(event.keyCode == "13")
                {
                    //alert('你输入的内容为：' + $('#dataInput').val());
                    document.location = '/adviceHome/searchUser/' + document.getElementById('search').value;
                    return false;
                }
            });
        });
        function Foo() {
            document.location = '/adviceHome/searchUser/' + document.getElementById('search').value;
        }

    </script>

@endsection